python for if else 在同一行
a = 'abc'
b = a if 'a' in a else 'not a'
a_list = [1, 2, 3, 4]
b_list = [i*2 for i in a_list if i%2==0]
c_list = [i*2 if i%2==0 else i for i in a_list ]
a = 'abc'
b = a if 'a' in a else 'not a'
a_list = [1, 2, 3, 4]
b_list = [i*2 for i in a_list if i%2==0]
c_list = [i*2 if i%2==0 else i for i in a_list ]